<?php
session_start();

/**
 * Script used see if user is logged in and welcome the user to the site
 */

// Return json encoded data
header ('Content-type: application/json');

require_once '../core/db.php';
$sql = "SELECT * FROM siteUsers WHERE userID=:usrName";
$query = $db -> prepare($sql);
$query -> bindParam(':usrName', $_SESSION["user"]);
$query -> execute();
$res = $query -> fetch();
if(isset($res['userName'])){

	echo "<h4>Hei, {$res['userRealName']}!</h4>
		<p>Nedenfor finner du dine muligheter: </p>";

} else {
	echo "Du er ikke logget inn";
}